package com.dragon.aipictures.test2;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Component;

import javax.sql.DataSource;

@Component
public class DataMigratorFactory {
    @Autowired
    private DataSource dataSource;
    
    @Autowired
    private JdbcTemplate jdbcTemplate;

    /**
     * 创建数据迁移器（基础版）
     */
    public DataMigrator createMigrator(Long spaceId) {
        return new DataMigrator(
            spaceId, 
            dataSource,
            jdbcTemplate,
            4  // 默认分片数
        );
    }

    /**
     * 创建自定义分片迁移器（扩展用）
     */
    public DataMigrator createMigrator(Long spaceId, int shardCount) {
        return new DataMigrator(
            spaceId,
            dataSource,
            jdbcTemplate,
            shardCount
        );
    }
}